import socket

def sendMessage(INPUTS : length, connection, message):
  diffLength = length - len(message)
  toSend = message+' '*diffLength
  totalsent = 0
  while totalsent < length:
    sent = connection.send(toSend[totalsent:])
    if sent == 0:
      raise RuntimeError, "socket connection broken"
    totalsent = totalsent + sent
